package servlet;

import java.io.IOException;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.sun.corba.se.spi.legacy.connection.GetEndPointInfoAgainException;

import entity.Item;

public class Test extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		Item item=new Item();
		item.setName("ali");
		item.setStock(0);
		
		EntityManagerFactory emf=Persistence.createEntityManagerFactory("cmpe473Project2");
		EntityManager em=emf.createEntityManager();  		
		em.persist(item);		
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}
